<?php

namespace Gwit\PlateformBundle\Entity;

use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * Gwit\PlateformBundle\Entity\User
 * 
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Gwit\PlateformBundle\Entity\UserRepository")
 * 
 */
class User extends BaseUser
{
    /**
     * @var integer $id
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string $first_name
     * 
     * @ORM\Column(name="first_name", type="string", length=255)
     * 
     */
    private $first_name;

    /**
     * @var string $last_name
     * 
     * @ORM\Column(name="last_name", type="string", length=255)
     * 
     */
    private $last_name;

    /**
     * @var string $family_name
     * 
     * @ORM\Column(name="family_name", type="string", length=255)
     * 
     */
    private $family_name;

    /**
     * @var date $date_of_birth
     * 
     * @ORM\Column(name="date_of_birth", type="date", nullable="true")
     * @Assert\DateTime()
     */
    private $date_of_birth;

    /**
     * @var string $nationality
     * 
     * @ORM\Column(name="nationality", type="string", length=255)
     * 
     */
    private $nationality;

    /**
     * @var string $security_question
     * 
     * @ORM\Column(name="security_question", type="string", length=255)
     * 
     */
    private $security_question;

    /**
     * @var string $security_answer
     * 
     * @ORM\Column(name="security_answer", type="string", length=255)
     * 
     */
    private $security_answer;

    /**
     * @var date $date_account_time
     * 
     * @ORM\Column(name="date_account_time", type="date", nullable="true")
     */
    private $date_account_time;

    /**
     * @var date $dateCreated
     * 
     * @ORM\Column(name="dateCreated", type="date")
     */
    private $dateCreated;

    /**
     * @var date $dateUpdated
     * 
     * @ORM\Column(name="dateUpdated", type="date")
     */
    private $dateUpdated;
    
    /**
     * @var string $cle
     * 
     * @ORM\Column(name="validationKey", type="string", length="32") 
     */
    private $cle;

    public function __construct()
    {
        $this->salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
        $this->generateConfirmationToken();
        $this->enabled = false;
        $this->locked = false;
        $this->expired = false;
        $this->roles = array();
        $this->credentialsExpired = false;
        $this->dateCreated = new \Datetime();
        $this->dateUpdated = new \Datetime();
        $this->date_of_birth = new \Datetime();
        $this->date_account_time = new \Datetime();
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set first_name
     *
     * @param string $firstName
     */
    public function setFirstName($firstName)
    {
        $this->first_name = $firstName;
    }

    /**
     * Get first_name
     *
     * @return string 
     */
    public function getFirstName()
    {
        return $this->first_name;
    }

    /**
     * Set last_name
     *
     * @param string $lastName
     */
    public function setLastName($lastName)
    {
        $this->last_name = $lastName;
    }

    /**
     * Get last_name
     *
     * @return string 
     */
    public function getLastName()
    {
        return $this->last_name;
    }

    /**
     * Set family_name
     *
     * @param string $familyName
     */
    public function setFamilyName($familyName)
    {
        $this->family_name = $familyName;
    }

    /**
     * Get family_name
     *
     * @return string 
     */
    public function getFamilyName()
    {
        return $this->family_name;
    }

    /**
     * Set date_of_birth
     *
     * @param date $dateOfBirth
     */
    public function setDateOfBirth($dateOfBirth)
    {
        $this->date_of_birth = $dateOfBirth;
    }

    /**
     * Get date_of_birth
     *
     * @return date 
     */
    public function getDateOfBirth()
    {
        return $this->date_of_birth;
    }

    /**
     * Set nationality
     *
     * @param string $nationality
     */
    public function setNationality($nationality)
    {
        $this->nationality = $nationality;
    }

    /**
     * Get nationality
     *
     * @return string 
     */
    public function getNationality()
    {
        return $this->nationality;
    }

    /**
     * Set security_question
     *
     * @param string $securityQuestion
     */
    public function setSecurityQuestion($securityQuestion)
    {
        $this->security_question = $securityQuestion;
    }

    /**
     * Get security_question
     *
     * @return string 
     */
    public function getSecurityQuestion()
    {
        return $this->security_question;
    }

    /**
     * Set security_answer
     *
     * @param string $securityAnswer
     */
    public function setSecurityAnswer($securityAnswer)
    {
        $this->security_answer = $securityAnswer;
    }

    /**
     * Get security_answer
     *
     * @return string 
     */
    public function getSecurityAnswer()
    {
        return $this->security_answer;
    }

    /**
     * Set date_account_time
     *
     * @param date $dateAccountTime
     */
    public function setDateAccountTime($dateAccountTime)
    {
        $this->date_account_time = $dateAccountTime;
    }

    /**
     * Get date_account_time
     *
     * @return date 
     */
    public function getDateAccountTime()
    {
        return $this->date_account_time;
    }

    /**
     * Set dateCreated
     *
     * @param date $dateCreated
     */
    public function setDateCreated($dateCreated)
    {
        $this->dateCreated = $dateCreated;
    }

    /**
     * Get dateCreated
     *
     * @return date 
     */
    public function getDateCreated()
    {
        return $this->dateCreated;
    }

    /**
     * Set dateUpdated
     *
     * @param date $dateUpdated
     */
    public function setDateUpdated($dateUpdated)
    {
        $this->dateUpdated = $dateUpdated;
    }

    /**
     * Get dateUpdated
     *
     * @return date 
     */
    public function getDateUpdated()
    {
        return $this->dateUpdated;
    }
    
    /**
     *
     * @return type 
     */
    public function getCle(){
        return $this->cle;
    }
    
    /**
     *
     * @param type $cle 
     */
    public function setCle($cle){
        $this->cle = $cle;
    }
    
    /**
     *
     * @return type 
     */
    public function getActif(){
        return $this->actif;
    }
    
    /**
     *
     * @param type $actif 
     */
    public function setActif($actif){
        $this->actif = $actif;
    }
}